use tokio::runtime::Builder;
use std::time::Instant;
use std::thread;

pub async fn f1() {
    let handle = tokio::spawn(async {
        // Do some async work
        12
    });

    // Do some other work

    let out = handle.await.unwrap();
    println!("GOT {}", out);
}

pub async fn f2() {
    let rt = Builder::new_multi_thread()
        .worker_threads(2)
        .enable_all()
        .thread_name("my-custom-name")
        .thread_stack_size(3 * 1024 * 1024)
        .build()
        .unwrap();
    
    let h1 = rt.spawn_blocking(|| {
        12
    });
    let h2 = rt.spawn_blocking(|| {
        "return value"
    });

    println!("GOT {}", h1.await.unwrap());
    println!("GOT {}", h2.await.unwrap());  

    // has a panic here because: Cannot drop a runtime in a context where blocking is not allowed.
}